/*
 * @Author: your name
 * @Date: 2021-08-31 20:21:48
 * @LastEditTime: 2021-09-13 16:50:46
 * @LastEditors: Please set LastEditors
 * @Description: 客户信息相关
 * @FilePath: \weplus_weibao\src\consts\maintenanceteam\MaintenanceCustomInfoSetup.js
 */
import { reactive } from 'vue';
import { apiService } from '../../api/apiService';
import { showServerError } from '../../util/MessageDeal';
import { getMaintainctrlCustomrecordList } from '../../api/server';

export default function useMaintenanceInfoSetup () {
    const customerObj = reactive({
        customer_options: []
    });

    // 获取服务客户列表
    const queryCustomerRecorf = () => {
        return new Promise((resolve, reject) => {
            apiService({
                api: getMaintainctrlCustomrecordList,
                success: (data) => {
                    customerObj.customer_options = data.value;
                    resolve(data);
                },
                fail: (data) => {
                    showServerError(data);
                    reject(data);
                }
            });
        });
    };
    // onBeforeMount(async () => {
    //     await queryCustomerRecorf();
    // });
    return {
        queryCustomerRecorf,
        customerObj
    };
}
